
#pragma once

#include "zAcGiEnvironment.h"

#ifdef SCENEDLLIMPEXP
#undef SCENEDLLIMPEXP
#endif
#ifdef SCENEOE
#define SCENEDLLIMPEXP __declspec( dllexport )
#else
#define SCENEDLLIMPEXP
#endif

class UcDbImpRenderSettings;
class UcDbImpRenderEnvironment;
class UcDbImpRenderGlobal;
class UcDbImpMentalRayRenderSettings;

class SCENEDLLIMPEXP UcDbRenderSettings : public UcDbObject
{
public:
    UCRX_DECLARE_MEMBERS(UcDbRenderSettings);
    UcDbRenderSettings();
    virtual ~UcDbRenderSettings();

    virtual UcGiDrawable* drawable();
    Ucad::ErrorStatus setName(const UcString& strName);
    UcString name() const;
    void setDescription(const UcString& strDes);
    UcString description() const;
    void setDisplayIndex(int idx);
    int displayIndex() const;
    void setMaterialsEnabled(bool bEnabled);
    bool materialsEnabled() const;
    void setTextureSampling(bool bSampling);
    bool textureSampling() const;
    void setBackFacesEnabled(bool bEnabled);
    bool backFacesEnabled() const;
    void setShadowsEnabled(bool bEnabled);
    bool shadowsEnabled() const;
    Ucad::ErrorStatus setPreviewImageFileName(const UcString& strFileName);
    UcString previewImageFileName() const;
    void setDiagnosticBackgroundEnabled(bool bEnabled);
    bool diagnosticBackgroundEnabled() const;
    virtual Ucad::ErrorStatus dwgInFields (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields(UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields(UcDbDxfFiler* pFiler) const;

	virtual Ucad::ErrorStatus copyFrom(const UcRxObject* other);
    virtual ZSoft::UInt32 setAttributes(UcGiDrawableTraits* pTraits);

	virtual bool operator==(const UcDbRenderSettings& settings);

private:
    UcDbImpRenderSettings* mpImp;
};

class SCENEDLLIMPEXP UcDbMentalRayRenderSettings : public UcDbRenderSettings
{
public:
    UCRX_DECLARE_MEMBERS(UcDbMentalRayRenderSettings);
    UcDbMentalRayRenderSettings();
    virtual ~UcDbMentalRayRenderSettings();
    Ucad::ErrorStatus setSampling(int iMin, int iMax);
    void sampling(int& iMin, int& iMax) const;
    Ucad::ErrorStatus setSamplingFilter(UcGiMrFilter eFilter, double fWidth,
        double fHeight);
    void SamplingFilter(UcGiMrFilter& eFilter, double& fWidth, double& fHeight)
        const;
    Ucad::ErrorStatus setSamplingContrastColor(float r, float g, float b,
        float a);
    void samplingContrastColor(float& r, float& g, float& b, float& a) const;
    void setShadowMode(UcGiMrShadowMode eShadowMode);
    UcGiMrShadowMode shadowMode() const;
    void setShadowMapsEnabled(bool bEnabled);
    bool shadowMapsEnabled() const;
    void setRayTracingEnabled(bool bEnabled);
    bool rayTracingEnabled() const;
    Ucad::ErrorStatus setRayTraceDepth(int iReflection, int iRefraction,
        int iSum);
    void rayTraceDepth(int& iReflection, int& iRefraction, int& iSum) const;
    void setGlobalIlluminationEnabled(bool bEnabled);
    bool globalIlluminationEnabled() const;
    Ucad::ErrorStatus setGISampleCount(int iNum);
    int giSampleCount() const;
    void setGISampleRadiusEnabled(bool bEnabled);
    bool giSampleRadiusEnabled() const;
    Ucad::ErrorStatus setGISampleRadius(double fRadius);
    double giSampleRadius() const;
    Ucad::ErrorStatus setGIPhotonsPerLight(int iNum);
    int giPhotonsPerLight() const;
    Ucad::ErrorStatus setPhotonTraceDepth(int iReflection, int iRefraction,
        int iSum);
    void photonTraceDepth(int& iReflection, int& iRefraction, int& iSum) const;
    void setFinalGatheringEnabled(bool bEnabled);
    bool finalGatheringEnabled() const;
    Ucad::ErrorStatus setFinalGatheringMode(UcGiMrFinalGatheringMode mode);
    UcGiMrFinalGatheringMode finalGatheringMode() const;
    Ucad::ErrorStatus setFGRayCount(int iNum);
    int fgRayCount() const;
    void setFGRadiusState(bool bMin, bool bMax, bool bPixels);
    void fgSampleRadiusState(bool& bMin, bool& bMax, bool& bPixels) const;
    Ucad::ErrorStatus setFGSampleRadius(double fMin, double fMax);
    void fgSampleRadius(double& fMin, double& fMax) const;
    Ucad::ErrorStatus setLightLuminanceScale(double fLuminance);
    double lightLuminanceScale() const;
    Ucad::ErrorStatus setEnergyMultiplier(float fScale);
    float energyMultiplier() const;
    void setDiagnosticMode(UcGiMrDiagnosticMode eDiagnosticMode);
    UcGiMrDiagnosticMode diagnosticMode() const;
    Ucad::ErrorStatus setDiagnosticGridMode(
        UcGiMrDiagnosticGridMode eDiagnosticGridMode, float fSize);
    void diagnosticGridMode(
        UcGiMrDiagnosticGridMode& eDiagnosticGridMode, float& fSize) const;
    void setDiagnosticPhotonMode(
        UcGiMrDiagnosticPhotonMode eDiagnosticPhotonMode);
    UcGiMrDiagnosticPhotonMode diagnosticPhotonMode() const;
    void setDiagnosticSamplesMode(bool bDiagnosticSamplesMode);
    bool diagnosticSamplesMode() const;
    void setDiagnosticBSPMode(UcGiMrDiagnosticBSPMode eDiagnosticBSPMode);
    UcGiMrDiagnosticBSPMode diagnosticBSPMode() const;
    void setExportMIEnabled(bool bEnabled);
    bool exportMIEnabled() const;
    Ucad::ErrorStatus setExportMIFileName(const UcString& strFileName);
    UcString exportMIFileName() const;
    Ucad::ErrorStatus setTileSize(int iTileSize);
    int tileSize() const;
    void setTileOrder(UcGiMrTileOrder eTileOrder);
    UcGiMrTileOrder tileOrder() const;
    Ucad::ErrorStatus setMemoryLimit(int iMemoryLimit);
    int memoryLimit() const;
    enum ShadowSamplingMultiplier {
        kSamplingMultiplierZero = 0,
        kSamplingMultiplierOneEighth,
        kSamplingMultiplierOneFourth,
        kSamplingMultiplierOneHalf,
        kSamplingMultiplierOne,
        kSamplingMultiplierTwo
    };
    Ucad::ErrorStatus setShadowSamplingMultiplier(
        UcDbMentalRayRenderSettings::ShadowSamplingMultiplier multiplier);
    UcDbMentalRayRenderSettings::ShadowSamplingMultiplier shadowSamplingMultiplier() const;
    virtual Ucad::ErrorStatus dwgInFields (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields(UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields(UcDbDxfFiler* pFiler) const;
    virtual ZSoft::UInt32 setAttributes(UcGiDrawableTraits* pTraits);

	virtual bool operator==(const UcDbMentalRayRenderSettings& settings);

	Ucad::ErrorStatus copyFrom(const UcRxObject* other);

private:
	UcDbImpMentalRayRenderSettings* mpImpMentalRay;
};

class SCENEDLLIMPEXP UcDbRenderEnvironment : public UcDbObject
{
public:
    UCRX_DECLARE_MEMBERS(UcDbRenderEnvironment);
    UcDbRenderEnvironment();
    virtual ~UcDbRenderEnvironment();

    virtual UcGiDrawable* drawable();
    void setFogEnabled(bool bEnable);
    bool fogEnabled() const;
    void setFogBackgroundEnabled(bool bEnable);
    bool fogBackgroundEnabled() const;
    void setFogColor(const UcCmEntityColor& color);
    UcCmEntityColor fogColor() const;
    Ucad::ErrorStatus setFogDensity(double dNear, double dFar);
    void fogDensity(double& dNear, double& dFar) const;
    Ucad::ErrorStatus setDistances(double dNear, double dFar);
    void distances(double& dNear, double& dFar) const;
    void setEnvironmentImageEnabled(bool bEnabled);
    bool environmentImageEnabled() const;
    Ucad::ErrorStatus setEnvironmentImageFileName(const UcString& strFileName);
    UcString environmentImageFileName() const;
    virtual Ucad::ErrorStatus dwgInFields (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields(UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields(UcDbDxfFiler* pFiler) const;
    virtual ZSoft::UInt32 setAttributes(UcGiDrawableTraits* pTraits);

	virtual bool operator==(const UcDbRenderEnvironment& environment);

private:
    UcDbImpRenderEnvironment* mpImp;
};

class SCENEDLLIMPEXP UcDbRenderGlobal : public UcDbObject
{
public:
    UCRX_DECLARE_MEMBERS(UcDbRenderGlobal);
    enum Procedure
    {
        krView = 0,
        krCrop,
        krSelected
    };
    enum Destination
    {
        krWindow = 0,
        krViewport
    };
    UcDbRenderGlobal();
    virtual ~UcDbRenderGlobal();
    void setProcedureAndDestination(Procedure eProcedure,
        Destination eDestination);
    void procedureAndDestination(Procedure& eProcedure,
        Destination& eDestination) const;
    void setSaveEnabled(bool bEnabled);
    bool saveEnabled() const;
    Ucad::ErrorStatus setSaveFileName(const UcString& strFileName);
    UcString saveFileName() const;
    Ucad::ErrorStatus setDimensions(int w, int h);
    void dimensions(int& w, int& h) const;
    void setPredefinedPresetsFirst(bool bPredefinedPresetsFirst);
    bool predefinedPresetsFirst() const;
    void setHighInfoLevel(bool bHighInfoLevel);
    bool highInfoLevel() const;
    Ucad::ErrorStatus setExposureType(UcGiMrExposureType type);
    UcGiMrExposureType exposureType() const;
    virtual Ucad::ErrorStatus dwgInFields (UcDbDwgFiler* pFiler);
    virtual Ucad::ErrorStatus dwgOutFields(UcDbDwgFiler* pFiler) const;
    virtual Ucad::ErrorStatus dxfInFields (UcDbDxfFiler* pFiler);
    virtual Ucad::ErrorStatus dxfOutFields(UcDbDxfFiler* pFiler) const;

    Ucad::ErrorStatus copyFrom( const UcRxObject* other );

private:
    UcDbImpRenderGlobal* mpImp;
public:
	bool operator==(const UcDbRenderGlobal& global);
	UcString dimensionName() const;
};

